<template>
  <div>
    <page-table
      rowKey="tableName"
      ref="generatorPageTable"
      :query-api="table_queryPageApi"
      :columns="columns"
      :show-add-button="false"
      :show-delete-button="false"
      :toolBar="[]"
      :query-param="queryParam"
    >
      <template #customOperation="{record}">
        <a-button icon="plus" size="small" type="link" @click="createForm(record)">代码生成</a-button>
      </template>
    </page-table>
  </div>
</template>
<script>
import { table_queryPageApi, generatorFormUrl } from "@/api/generator/table";
//定义列表数据
const columns = [
  {
    title: "表名",
    dataIndex: "tableName",
    defaultSortOrder: "ascend",
    sorter: true,
  },
  {
    title: "备注",
    dataIndex: "comment",
  },
  {
    title: "字符编码集",
    dataIndex: "collation",
  },
  {
    title: "引擎",
    dataIndex: "engine",
  },
  {
    title: "创建时间",
    dataIndex: "createTime",
  },
  {
    title: "修改时间",
    dataIndex: "updateTime",
  },
  {
    title: "操作",
    scopedSlots: { customRender: "customOperation" },
    width: "140px",
    align: "center",
  },
];
//搜索数据
export default {
  data() {
    return {
      columns,
      queryParam: {},
      table_queryPageApi,
      generatorFormUrl,
    };
  },
  methods: {
    reloadTable() {
      this.$refs.generatorPageTable.reload();
    },
    createForm(record) {
      this.$router.push({
        path: generatorFormUrl,
        query: {
          tableName: record.tableName,
        },
      });
    },
  },
};
</script>